package com.tool.spring.manager;

import com.tool.spring.dao.UserDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: lixiaofei
 */
@Slf4j
public class UserManagerImpl  implements  UserManager{

   private UserDao userDao;

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    @Transactional
    public void addUser(String username, String password) {
        userDao.insertUser(username,password);
        log.info("UserManager.addUser()");
//        runTime();
    }

    //手动抛出异常的方法
    public void runTime() {
        throw new RuntimeException("异常！！！");
    }


}
